<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	template="../Template/Template.xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:rich="http://richfaces.org/rich">


	<ui:define name="title">
    Trang Hóa Đơn
  	</ui:define>


	<ui:define name="content">
		<!-- Content -->
		<div id="MainPanel" align="left">

			<h:form name="hoaDon" method="post">
				<div class="ContentPart">
					<h3 class="ContentPartHeader">THÔNG TIN NGƯỜI ĐẶT HÀNG</h3>
					<div class="ContentPartContent">
						<div class="ins">Tên người đặt:</div>
						<div class="info" id="tenNguoiDat">
							#{taiKhoanDangNhapBean.taiKhoan.hoten}</div>
						<div class="ins">Email:</div>
						<div class="info" id="email">#{taiKhoanDangNhapBean.taiKhoan.email}</div>
						<div class="ins">Địa chỉ:</div>
						<div class="info" id="diaChi">#{taiKhoanDangNhapBean.taiKhoan.diachi}</div>

					</div>
				</div>
				<div class="ContentPart">
					<h3 class="ContentPartHeader">THÔNG TIN NGƯỜI NHẬN HÀNG</h3>
					<div class="ContentPartContent">
						<div class="ins">Địa chỉ người nhận:</div>
						<div class="info" id="diaChiNguoiNhan">
							<h:outputText value="#{gioHangBean.diaChiNguoiNhan}">
							</h:outputText>
						</div>
						<br />
					</div>
				</div>
				<div class="ContentPart">
					<h3 class="ContentPartHeader">THÔNG TIN HÌNH THỨC THANH TOÁN</h3>
					<div class="ContentPartContent">
						<h:selectOneRadio value="#{gioHangBean.hinhThucThanhToan}">
							<f:selectItem itemValue="0" itemLabel="Thanh toán qua mạng" />
							<f:selectItem itemValue="1"
								itemLabel="Thanh toán tại nhà (Giao hàng)" />
						</h:selectOneRadio>
					</div>
					<!-- <div class="ContentPartContent">
						<input type="radio" name="groupThanhToan"
							value="Thanh toán qua mạng" checked="checked"> Thanh toán
						qua mạng <br /> <input type="radio" name="groupThanhToan"
							value="Thanh toán tại nhà (Giao hàng)"> Thanh toán tại
						nhà (Giao hàng)<br /> <a href="#"><span class="link">&nbsp;&nbsp;&nbsp;&nbsp;++>
								Hướng dẫn thanh toán</span></a>
					</div> -->
				</div>
				<div class="ContentPart">
					<h3 class="ContentPartHeader">THÔNG TIN GIỎ HÀNG</h3>
					<h:dataTable value="#{gioHangBean.lstSanPham}" var="sp"
						styleClass="tableDulieu"
						rendered="#{not empty gioHangBean.lstSanPham}" rowIndexVar="row">
						<h:column>
							<f:facet name="header">STT</f:facet>
							#{row + 1}							 		
						</h:column>
						<h:column>
							<f:facet name="header">TÊN SẢN PHẨM</f:facet>
							<h:commandLink action="#">#{sp.tensanpham}</h:commandLink>
						</h:column>
						<h:column>
							<f:facet name="header">SỐ LƯỢNG</f:facet>
							<h:outputText value="#{sp.soluongtronggiohang}"></h:outputText>
						</h:column>
						<h:column>
							<f:facet name="header">GIÁ BÁN</f:facet>
							<h:outputText value="#{sp.giaban}">
								<f:convertNumber groupingUsed="true" pattern="#0,000" />
							</h:outputText>
						</h:column>
						<h:column>
							<f:facet name="header">THÀNH TIỀN</f:facet>
							<h:outputText value="#{sp.giaban * sp.soluongtronggiohang}">
								<f:convertNumber groupingUsed="true" pattern="#0,000" />
							</h:outputText>
						</h:column>
					</h:dataTable>

					<!-- </form> -->
				</div>
				<div class="ContentPartContent" align="right">
					<h:dataTable align="right">
						<h:column>
							<f:facet name="header">Tổng thành tiền</f:facet>
						</h:column>
						<h:column>
							<f:facet name="header">
								<div style="width: 200px; display: inline-block;" align="right">
									<strong><font color="#FF0000"> <h:outputText
												value="#{gioHangBean.TinhTongTien()}">
												<f:convertNumber groupingUsed="true" pattern="#0,000" />
											</h:outputText> VNÐ
									</font></strong>
								</div>
							</f:facet>
						</h:column>
					</h:dataTable>
				</div>
				<br />

				<div class="ContentPart" align="right">
					<h:commandButton process="@this" immediate="true"
						class="buttonLink button" action="TrangGioHang"
						value="Trở lại giỏ hàng" />
					<h:commandButton
						class="buttonLink button"
						action="#{gioHangBean.ThucHienThanhToan()}" value="Thanh Toán" />
				</div>

			</h:form>
		</div>

		<!-- Content -->
	</ui:define>
</ui:composition>